package com.heima.apis.article;

/**
 * @author 胡慧
 * @title: IArticleClient
 * @projectName heima-leadnews
 * @description: 定义作者接口
 * @date 2021/2/2023:36
 */
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.pojos.ApAuthor;

import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("leadnews-article")
public interface IArticleClient {
    /**
     * 根据id查询作者
     * @param userId
     * @return
     */
    @GetMapping("/api/v1/author/findByUserId/{userId}")
    public ApAuthor findByUserId(@PathVariable("userId") Integer userId);

    /**
     * 添加作者信息
     * @param apAuthor
     * @return
     */
    @PostMapping("/api/v1/author/save")
    public ResponseResult save(@RequestBody ApAuthor apAuthor);

    /**
     * 保存文章
     * @param articleDto
     * @return
     */

    @PostMapping("/api/v1/article/save")
    public ResponseResult saveArticle(@RequestBody ArticleDto articleDto);

    /**
     * 根据id查找作者
     * @param id
     * @return
     */
    @GetMapping("/api/v1/author/one/{id}")
    ApAuthor selectById(@PathVariable("id") Integer id);
}